<?php
require 'config.php';
if (!session_id()) session_start();
error_reporting(E_ALL & ~E_NOTICE);
error_reporting();
if(isset($_GET['delete'])){   
	// 如果获取到delet的值
	unset($_SESSION['login']);
	// 则清空登录的状态，执行不了下面的if里的isset语句回到else下的语句
	header("location:http:index.php");
	// 跳回最开始的页面
}
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="zh-cn" xmlns="http://www.w33.org/1999/xhtml"></html>
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
	<title>旧衣物回收</title>
	<link rel="stylesheet" type="text/css" href="./css/top.css" charset=utf-8>
	<script type="text/javascript" src="./js/jquery-1.11.0.js"></script>
</head>


<body>


<div class="daohangzong">
	<div id="nav-header">
	<div class="header">
		<!-- logo板块 -->
		<a href="phpcode.php">
			<img src="./images/logo.jpg" width="60px" height="60px">
		</a>
		<!-- 菜单板块 -->
<nav>
	<ul>
		<li><a href="form_hs.php">旧衣物回收</a>
			<!-- <i class="slide-icon"></i> -->
		</li>
		<li><a href="index.php">首页</a></li>
		<li class="news">新闻<i class="slide-icon"></i>
			<div class="slide-submeu news-submenus">
				<strong>校园动态</strong>
				<a href="http://www.fzfu.com/" target="_blank"><div class="school-icon"></div> 学校官网</a>
				<!-- <a href="http://jw.fzfu.edu.cn/jwglxt/xtgl/login_slogin.html?language=zh_CN&login_type=undefined"  target="_blank"><div class="in-icon"></div> 成绩查询</a> -->
				
				<strong>本站资讯</strong>
				<a href="">网站简介</a>
				<!-- <a href="">最热交易</a> -->

				<strong>其他新闻</strong>
				<a href="">123123</a>
				<!-- <a href="">456456</a>
				<a href="">789789</a> -->
			</div>
		</li>
		<li>精选<i class="slide-icon"></i>
			<div class="slide-submeu">
				<a href="">123123</a>
				<!-- <a href="">456456</a>
				<a href="">789789</a> -->
			</div>
		</li>
		<li>兼职<i class="slide-icon"></i>
		<div class="slide-submeu">
				<a href="">123123</a>
				<!-- <a href="">456456</a>
				<a href="">789789</a> -->
			</div>
		</li>
		<li>社区<i class="slide-icon"></i>
			<div class="slide-submeu">
				<a href="">123123</a>
				<!-- <a href="">456456</a>
				<a href="">789789</a> -->
			</div>
		</li>

	</ul>
</nav>
<div class="search">
	<form action="search.php" name="form_search">
		<input type="input" name="search" id="search" placeholder="搜索物品">
		<span class="search-icon" id="search_bottom" onclick="document.form_search.submit()"></span><!-- 提交表单 -->
	</form>
</div>



<!-- 注册登录板块开始 -->
<!-- <div class="nav-other">
	<span class="user-info">
		<a href="#">注册</a>
		<i></i>
		<a href="http://localhost/school/login/index.php">登录</a>
	</span>
</div> -->
 
<?php
// // 获取登录信息
session_start();
$email=$_SESSION['login'];
$query_email="SELECT * FROM carts WHERE `uemail`='$email'";
$result_email=mysqli_query($config,$query_email);
$row_email=mysqli_fetch_array($result_email);
// echo $row_email['uemail'];
$user_email=$row_email['buyerid'];




// $query  = "SELECT * FROM carts WHERE buyerid ORDER BY buyerid DESC";
// 		$result = mysqli_query($config,$query) or die('SQL语句有误：'.mysql_error());
// 		$row=mysqli_fetch_array($result);

$con = "SELECT * FROM users WHERE uemail='".$_SESSION['login']."'";
$que = mysqli_query($config,$con);


$userinfo = mysqli_fetch_array($que,MYSQLI_ASSOC);
       if(isset($_SESSION['login'])){ ?>    <!-- 提前结束php语句 -->
<div class="nav-other" id="nav-other">
	<span class="user-info">

		<a href="top.php?delete=1">退出</a>
		<i></i>
		<a href="cart.php?buyerid=<?php echo $user_email;?>">购物车</a>
		<i></i>
		<a href="manage.php">管理</a>
		<i></i>
		<a href="information.php"><?php echo $userinfo['uname'] ?></a>
		<p>欢迎</p>
	</span>    <!-- 倒叙（从下到上）的内容 -->
</div> 
<?php }else{?>
	<div class="nav-other" id="nav-other">
		<span class="user-info1">
			<a href="login/register.php">注册</a>
			<i></i>
			<a href="login/index.php">登录</a>
		</span>
	<?php } ?>
	</div>



<!-- 注册登录板块结束 -->
	</div>
</div>
</div>
<!-- <div style="width: 1000px;height: 1900px;border:1px solid red;margin: 0 auto;margin-top: 10px;"></div> -->
</body>
<script type="text/javascript">
	$(function(){
		var nav_position=10;
		// var nav_position=$('#nav-header').height();
		$(document).scroll(function(){
			$(window).scrollTop()>=nav_position?$('#nav-header').addClass('fixed'):$('#nav-header').removeClass('fixed');
			// 导航条置顶
		})
	})
</script>
</html>